Transparent Interconnection of Lots of Links (TRILL), as a layer 2 forwarding technology, is used to implement interconnection between data centers.
FIG. 1 is a typical networking diagram of the TRILL. A node in TRILL networking is referred to as a routing bridge (RB). In typical TRILL networking, an RB located at a core layer can be configured as a layer 3 gateway. For example, four nodes at an upper layer shown in FIG. 1 are configured to implement packet forwarding in a current data center and packet forwarding between the current data center and another data center; and an RB located at an access layer (hereinafter referred to as an access device) is configured to connect to a user side device, for example, five nodes at a lower layer shown in FIG. 1. The access device sends, to a gateway according to a learned relationship between a nickname of the RB and a media access control (MAC) address, a packet destined to a user side device connected to another access device in the current data center or a packet destined to a user side device in another data center, and then the gateway forwards the packet to the destination device.
To implement load sharing among multiple gateways, the multiple gateways may be aggregated into one gateway aggregation group (also referred to as a multi-active gateway), and a virtual nickname and a virtual MAC address are allocated to the gateway aggregation group. Each gateway device in a gateway aggregation group has a same virtual nickname and virtual MAC address.
The gateway aggregation group performs packet forwarding based on a load sharing mechanism, so that packets from a same source may be forwarded through different gateway devices in the gateway aggregation group. When performing layer 3 forwarding, a gateway device in the gateway aggregation group performs packet encapsulation by using the nickname and the MAC address of the gateway aggregation group. In this way, when a MAC address is learned on an access device, a learned MAC address and nickname are the virtual MAC address and the virtual nickname of the gateway aggregation group. In a backhaul direction, after receiving a packet sent by a gateway, the access device first performs a Reverse Path Forwarding (RPF) check, that is, queries a MAC address table by using a source MAC address and a source nickname of the packet, and determines whether a found outbound port is consistent with a receiving port of the packet. If the found outbound port is consistent with the receiving port of the packet, the access device queries, according to a destination MAC address of the packet, a matched MAC address entry, and forwards the packet; and if the found outbound port is inconsistent with the receiving port of the packet, the packet is discarded. For the layer 3 forwarding, the outbound port that is in the MAC address entry and is previously learned by the access device may be inconsistent with the receiving port of the packet (for example, for packets sent to a same user of the access device, the gateway aggregation group distributes a packet in previous load sharing to a gateway 1 to forward the packet to the access device, and distributes a current packet in current load sharing to a gateway 2 to forward the current packet to the access device, that is, for packets with a same source MAC address and a same source nickname, a current receiving port is inconsistent with a previous receiving port). Therefore, the RPF check fails, so that the packet forwarding fails.
Therefore, a technical problem that exists in the prior art is that: for layer 3 forwarding, an access device learns a correspondence among a virtual MAC address and a virtual nickname of a gateway aggregation group and a port, and performs packet forwarding processing based on a MAC address table, and therefore, a technical problem of a failure of an RPF check may be caused.